package io.renren.modules.weixin.service.impl;

import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.weixin.dao.PingjiaDao;
import io.renren.modules.weixin.entity.PingjiaEntity;
import io.renren.modules.weixin.service.PingjiaService;


@Service("pingjiaService")
public class PingjiaServiceImpl extends ServiceImpl<PingjiaDao, PingjiaEntity> implements PingjiaService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<PingjiaEntity> page = this.selectPage(
                new Query<PingjiaEntity>(params).getPage(),
                new EntityWrapper<PingjiaEntity>()
        );

        return new PageUtils(page);
    }

    public PageUtils queryByCaipuid(Map<String, Object> params){
        EntityWrapper<PingjiaEntity> queryWrapper = new EntityWrapper<>();
        queryWrapper.eq("caipuid", params.get("caipuid"));

        Page<PingjiaEntity> page = this.selectPage(
                new Query<PingjiaEntity>(params).getPage(),
                queryWrapper
        );

        return new PageUtils(page);
    }
}
